<?php

class Default_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        
        $option=array( 
        	"layout" => "layout", 
        	"layoutPath" => APPLICATION_PATH."/layouts/scripts/default" 
      	); 
      	Zend_Layout::startMvc($option); 
        
      	$this->view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
      	
    }

    public function indexAction()
    {
        /////get khu vực
        $getkhuvuc = new Api_Model_GetKhuVuc();
        $rsGetKhuVuc = $getkhuvuc->GetAll();
        
        $this->view->rsKhuvuc = $rsGetKhuVuc;
        
        ////get bàn
        $getdsban = new Api_Model_GetDmban();
        $rsGetDmBan = $getdsban->GetAll();
        
        $this->view->rsDmban = $rsGetDmBan;
    }
    
    public function vieworderAction()
    {
        $ngayhientai = date("d-m-Y");
        $luutam= new Api_Model_Luutam();
        $ngaydatmon = $this->_request->getParam( "Ngaydatmon", $ngayhientai );        
        $ngay = $pieces = explode("-", $ngaydatmon); 

       	$tungay = $ngay[2] . '-' . $ngay[1] . '-' .  $ngay[0] . ' 00:00:00';
		$denngay = $ngay[2] . '-' . $ngay[1] . '-' .  $ngay[0] . ' 23:59:59';
        
        $rsOder = $luutam->getDsmon($tungay,$denngay,$ngaydatmon);
        
        
        $this->view->rsOder = $rsOder;
        $this->view->ngayhientai = $ngaydatmon;
    }
}

